//
//  detailCell.m
//  PaiQuan
//
//  Created by Mac on 16/7/12.
//  Copyright © 2016年 huigu. All rights reserved.
//

#import "detailCell.h"

@implementation detailCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setupSubviews];
        [self setConstraints];
    }
    return self;
}
-(void)setupSubviews{
   
    [self.contentView addSubview:self.titleLabel];
    
    [self.contentView addSubview:self.lineView];
    [self.contentView addSubview:self.detailSwitch];
}
-(void)setConstraints{
    
    [self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.contentView.left).offset(RATIO(20));
        make.centerY.equalTo(self.contentView);
    }];
    [self.lineView makeConstraints:^(MASConstraintMaker *make) {
        make.width.bottom.left.equalTo(self.contentView);
        make.height.equalTo(RATIO(6));
        
    }];
    [self.detailSwitch makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView.right).offset(-RATIO(20));
        
    }];
    
    
    
    
}

#pragma mark --懒加载

-(UIView*)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = PQ_COLOR_SimpleGary;
    }
    return _lineView;
    
    
    
    
}
-(UISwitch*)detailSwitch{
    if (_detailSwitch == nil) {
        _detailSwitch = [[UISwitch alloc] init];
        
    }
    return _detailSwitch;
    
    
}
-(UILabel*)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        [_titleLabel setFont:FONT(15)];
    }
    return _titleLabel;
    
    
    
}


@end
